/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SISAC.DACEA.DS;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 *
 * @author Abel
 */
public class Conexion {
    private static final String url= "jdbc:sqlserver://DAVIS-PC\\localhost:1433;databaseName=SISAC.DACEA.DB.BACKUP";
    private static final String user = "sa";
    private static final String password= "123456";
    
    
public Conexion(){}
    public synchronized Connection getConnection(){
        Connection connection=null;
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            connection=DriverManager.getConnection(url,user,password);
            System.out.println("Conecion Hecha...oooohh");
        } catch (Exception e) {
            connection=null;
            System.out.println("Error en la Conecion "+e.getMessage());
        }
        return connection;
    }
    public synchronized void closeConnection(Connection connection){
        try {
            connection.close();
        } catch (Exception e) {
            System.out.println("Error al cerrar conexion"+e);
        }
    }
    
}
